<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>匿名函数</title>
</head>

<body>
<center>
    <br>
    <p>通过匿名函数处理事件</p>
    <form name="MyForm" id="MyForm">
        <input type="button" name="MyButton" id="MyButton" value="test">
    </form>
    <script language="JavaScript" type="text/javascript">

        document.MyForm.MyButton.onclick = clickButton;
        function clickButton() {
            alert("已经点击该按钮！");
        }

    </script>
</center>
</body>
</html>